<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>transform-centering</title>
    <style>
        .parent {
            border: 1px solid #9c27b0;
            height: 250px;
            width: 250px;
            position: relative;
        }
        .child {
            text-align: center;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child">Centered content</div>
    </div>
</body>
</html>